package chapter_21.generic_method;

/**
 * Created by Administrator
 * Created time 2018/8/8 19:00.
 */
public class MethodLimitTest {

    // 限定类型参数为 Number 类型
    public static <T extends Number> boolean isEquals(T a, T b){
        return a.equals(b);
    }

    public static void main(String[] args) {
        System.out.println(isEquals(new Integer(1), new Integer(5)));
        System.out.println(isEquals(1, 5));
        System.out.println(isEquals(new Double(1.00), new Double(5.00)));
        System.out.println(isEquals(1.0, 5.0));
        // System.out.println(isEquals('A', 'A'));
    }
}
